﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;
using DataAccessClasses;

namespace eschoolBO
{
    public class user_types
    {
        iDAC DAC = DACFactory.GetDAC();
        private long _user_type_id = -99;
        private string _user_type = "";
        private bool _isdeleted = false;
        public long user_type_id
        {
            get
            {
                return _user_type_id;
            }
            set
            {
                _user_type_id = value;
            }
        }
        public string user_type
        {
            get
            {
                return _user_type;
            }
            set
            {
                _user_type = value;
            }
        }
        public bool isdeleted
        {
            get
            {
                return _isdeleted;
            }
            set
            {
                _isdeleted = value;
            }
        }
        public long SaveRecords()
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@user_type_id", user_type_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@user_type", user_type, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@isdeleted", isdeleted, DbType.Boolean, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2};
                return DAC.Save("user_type_save", dbparamcall);
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return -99;
        }
        public DataTable GetRecords(long user_type_id, string user_type, bool isdeleted, string paraandor)
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@user_type_id", user_type_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@user_type", user_type, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@isdeleted", isdeleted, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@paraandor", paraandor, DbType.AnsiString, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3 };
                DataTable dt1 = DAC.Select("user_type_get", dbparamcall);
                return dt1;
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return null;
        }
    }
}
